using System.Collections;
using Slaks.Graphs.GraphBuilder;

namespace Slaks.GraphExtensions.GraphBuilder
{
	public class SuperGraphBuilderFactory
	{
		private static Hashtable m_builders;

		static SuperGraphBuilderFactory()
		{
			m_builders = new Hashtable();
		}

		public static IRepresentationExtended GetGraphBuilder(BuilderType builderType)
		{
			IRepresentationExtended representation = null;
			representation = (IRepresentationExtended) m_builders[builderType];
			return representation;
		}

		public static bool AddGraphBuilder(BuilderType builderType, IRepresentationExtended builder)
		{
			if (m_builders.Contains(builderType) == false)
			{
				m_builders.Add(builderType, builder);
				return true;
			}
			return false;
		}

		public static bool RemoveGraphBuilder(BuilderType builderType)
		{
			if (m_builders.Contains(builderType) == false) return false;
			m_builders.Remove(builderType);
			return true;
		}

		public bool IsGraphBuilderExists(BuilderType builderType)
		{
			return m_builders.Contains(builderType);
		}

		private SuperGraphBuilderFactory()
		{
		}
	}
}